package com.salt.modules.flow.feign;


import com.salt.common.constant.Common;
import com.salt.modules.flow.entity.WorkFlow;
import com.salt.modules.flow.hystrix.FlowTaskClientHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description 流程控制中心（流程任务）远程调用接口
 * @Author salt
 * @Date 2021/11/30
 * @Version 1.0.1
 */
@FeignClient(name = Common.Service.SALT_FLOW_SERVICE_NAME,
        path = Common.Service.SALT_FLOW_TASK_URL_PREFIX,
        fallbackFactory = FlowTaskClientHystrix.class)
public interface FlowTaskClient {

    String API_PREFIX = "/client";
    String HIS_FLOW_LIST = API_PREFIX + "/historicFlowList";

    /**
     * 获取流转历史列表（流程信息）
     * @param procInsId 流程实例ID
     * @param startFlow 开始活动节点名称
     * @param endFlow 结束活动节点名称
     * @return 工作流集合
     */
    @PostMapping(HIS_FLOW_LIST)
    public List<WorkFlow> historicFlowList(@RequestParam("procInsId") String procInsId,
                                           @RequestParam("startFlow") String startFlow,
                                           @RequestParam("endFlow") String endFlow);
}
